use "$dir\DataSCLB.dta", clear 
	count if Study_Arm==0
	local ncon = r(N)
	count if Study_Arm==1
	local n_cct = r(N)
	count if Study_Arm==2
	local n_mt = r(N)	
	set matsize 11000
		// Sample Size of CCT
		use "$dir\DataSCLB.dta", clear 
			isd_pval EL_EGRA_PCA_Index, r(10000) mt(1.5) cct(0.5) ssize_c(`ncon') ssize_t(`n_cct')
		save "$dir/ISD_distribution_`n_cct'.dta", replace	
		// Samples size of MT 
		use "$dir\DataSCLB.dta", clear 
			isd_pval EL_EGRA_PCA_Index, r(10000) mt(1.5) cct(0.5) ssize_c(`ncon') ssize_t(`n_mt')
		save "$dir/ISD_distribution_`n_mt'.dta", replace	

		
	// Table
		use "$dir\DataSCLB.dta", clear 
			count if Study_Arm==0
			local ncon = r(N)
			count if Study_Arm==1
			local n_cct = r(N)
			count if Study_Arm==2
			local n_mt = r(N)	
		use "$dir/ISD_distribution_`n_mt'.dta", clear
			local percentiles 50 60 70 80 90 95 99 99.9 99.99 
			local num : list sizeof local(percentiles)
			// MT impact
			_pctile isd_MT, p(`percentiles')
			return list
			mat P = J(`num',3,.)
			local i = 1
			foreach j of local percentiles {
				mat P[`i',1] = (100-`j')/100 
				mat P[`i',2] = round(r(r`i'),0.001) 
				local i = `i'+1
			}
			// CCT impact
			_pctile isd_CCT, p(`percentiles')
			return list
			local i = 1
			foreach j of local percentiles {
				mat P[`i',3] = round(r(r`i'),0.001) 
				local i = `i'+1
			}		

			clear 
			svmat P
			ren P2 Sample1_1
			ren P3 Sample1_2
			tempfile sample1
			save `sample1'
		// Other Sample size
		use "$dir/ISD_distribution_`n_cct'.dta", clear
			local percentiles 50 60 70 80 90 95 99 99.9 99.99 
			local num : list sizeof local(percentiles)
			// MT
			_pctile isd_MT, p(`percentiles')
			return list
			mat P = J(`num',3,.)
			local i = 1
			foreach j of local percentiles {
				mat P[`i',1] = (100-`j')/100 
				mat P[`i',2] = round(r(r`i'),0.001) 
				local i = `i'+1
			}
			// CCT
			_pctile isd_CCT, p(`percentiles')
			return list
			local i = 1
			foreach j of local percentiles {
				mat P[`i',3] = round(r(r`i'),0.001) 
				local i = `i'+1
			}		
			clear
			svmat P
			ren P2 Sample2_1
			ren P3 Sample2_2
		//Merge	
			merge 1:1 P using `sample1', nogen
			gsort - P1 
			local ncon2: di %12.0fc `ncon'
			local n_mt2: di %12.0fc `n_mt'
			local n_cct2: di %12.0fc `n_cct'
	// EXPORT		
			foreach var in * {
				format `var' %10.4f
				tostring `var', replace format(%10.4f) force
			}	
			*format P1 %10.4fs
			keep P1 Sample1_1 Sample2_1
			
	save "$output/AppendixTable6.dta", replace			